<template>
  <div>
    {{ tip }}
  </div>
</template>

<script>
export default {
  name: "loginOauth",
  data: function () {
    return {
      tip: '正在跳转到Oauth登录页.....'
    }
  },
  mounted() {
    let that = this;
    if (this.$route.query.msg && this.$route.query.msg === "success" && this.$route.query.token) {
      that.tip = "登录成功,正在跳转到Admin首页..."
      this.$store.commit("SetToken", this.$route.query.token)
      setTimeout(() => {
        that.$router.push("/page/index")
      }, 1000)
    } else if (this.$route.query.msg && this.$route.query.msg === "error") {
      that.tip = "登录失败,请稍后再试..."
    } else {
      if (that.$store.state.token) {
        that.tip = "跳转到Admin首页..."
        setTimeout(() => {
          that.$router.push("/page/index")
        }, 1000)
      } else {
        that.tip = "正在跳转到Oauth登录页....."
        setTimeout(() => {
          window.location.href = "http://127.0.0.1:9600/account/login"
        }, 1000)
      }
    }
  }
}
</script>

<style scoped>

</style>
